/**
 *
 * Copyright Pact Lab of H.I.T.
 *
 * Designed and Implemented by Grid Researching Group, 
 * Pact Lab, Harbin
 * 
 * This Project is part of the national 973 Project:
 * Internet Based Virtual Computing Environment
 *
 * http://pact518.hit.edu.cn
 * 
 * Author:       Meteor <meteorlxk@gmail.com> 
 * Copyright:    pact518 
 * Version:      1.0
 * Created:      2009-4-21 
 * LastModified: 2009-4-21
 */
package edu.hit.pact.pgse.master.util;

import java.net.InetAddress;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.mina.core.session.IoSession;

import edu.hit.pact.pgse.crawler.util.SleepThread;
import edu.hit.pact.pgse.master.MasterManager;
import edu.hit.pact.pgse.util.AbstractThread;

/**
 * @author Meteor
 *
 */
public class CrawlerDeadHandler extends Thread{

	private Log logger;
	private MasterManager masterManager;
	private InetAddress ip;
	
	
	public CrawlerDeadHandler(MasterManager masterManager, InetAddress ip) {
		this.logger = LogFactory.getLog(CrawlerDeadHandler.class);
		this.masterManager = masterManager;
		this.ip = ip;
	}

	/* (non-Javadoc)
	 * @see edu.hit.pact.pgse.util.AbstractThread#mainRun()
	 */
	public void run() {
		logger.error("alive checker running");
		SleepThread.sleep(6000);
		masterManager.restartPieces(ip);
	}
}
